package com.example.animaldoctor03;

import java.util.ArrayList;
import java.util.List;

import bingliandshuju.SingleDataofAll;

import com.example.animaldoctor03.R;

import Modle.disease.ClinicalSymptomsKey;
import Modle.disease.Symptoms;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification.Builder;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class YiXuanZhengZhuang  extends Activity{
	
	private Symptoms symptomsofXZgetinformation = null ;
	private List<Object> listofXZgetinformation = new ArrayList<Object>();
	private ListView listofyixuanzhengzhuang = null;
	private void getInformationofXZ (){
		
		SingleDataofAll singleDataofXZ = SingleDataofAll.getInstance();
		symptomsofXZgetinformation = singleDataofXZ.getObject();
		listofXZgetinformation = singleDataofXZ.getListinformation();
	}
	
	private void chushihua(){
		
		setContentView(R.layout.yixuanzhengzhuang);
			listofyixuanzhengzhuang = (ListView)findViewById(R.id.listofyixuanzhengzhuang);
	}
	private void shezhiKJ(){
		try{
		getInformationofXZ();
		
		List<String> listofAChoiceofXZ = new ArrayList<String>();
		if(symptomsofXZgetinformation != null){
		listofAChoiceofXZ.add(symptomsofXZgetinformation.getSymptomsName());
		}
		for(int i = 0 ; i < listofXZgetinformation.size(); i ++ ){
			
			ClinicalSymptomsKey ctextofBL3 = (ClinicalSymptomsKey) listofXZgetinformation.get(i);
			listofAChoiceofXZ.add(ctextofBL3.getClinicalSymptomsKey());
			
		}
		String [] allchoice =  new String [listofAChoiceofXZ.size()];
		for(int i = 0 ; i < listofAChoiceofXZ.size() ; i++){
			
			allchoice[i] = listofAChoiceofXZ.get(i);
		}
		
		ArrayAdapter<String> arrayAdapter =  new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1 ,allchoice);
 		
		listofyixuanzhengzhuang.setAdapter(arrayAdapter);
		}catch(NullPointerException e){
			android.app.AlertDialog.Builder builderofYXZZ = new AlertDialog.Builder(YiXuanZhengZhuang.this);
			builderofYXZZ.setMessage("没有数据,请选择其他功能");
			builderofYXZZ.create().show();
		}
	}
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		chushihua();
		getInformationofXZ ();
		shezhiKJ();
		
	
	}

}
